package com.zhang.demoaidl;

import aidl.Book;
import aidl.IAidlserver;
import aidl.IAidlserver.Stub;
import android.app.Service;
import android.content.Intent;
import android.nfc.Tag;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class DemoAidlserver extends Service {
	
	private String TAG = "DemoAidlserver---->";
	private Book mbook;
	@Override
	public void onCreate() {
		super.onCreate();
		Log.e(TAG, "Service.....oncreate");
		mbook = new Book();
	}
	@Override
	public IBinder onBind(Intent intent) {
		return mBinder;
	}
	
	private IAidlserver.Stub mBinder = new Stub() {
		
		@Override
		public String sayhello() throws RemoteException {
			return "hello";
		}
		
		@Override
		public Book getbook() throws RemoteException {
			
			mbook.setprice(100);
			
			return mbook;
		}

		@Override
		public void setString(String a) throws RemoteException {
			mbook.setname(a);
		}
	};
}
